<script setup>
import {ArrowRight} from "@element-plus/icons-vue";
import {ref} from "vue";
import {useUserStore} from '@/stores/user.js'
import {storeToRefs} from 'pinia';

const userStore = useUserStore();
let {avatar, nickname} = storeToRefs(userStore)


const breadcrumbList = ref(['系统管理', '用户管理', '支付管理'])
</script>

<template>
  <div class="header_container">
    <div class="header_left">
      <el-breadcrumb separator="/" :separator-icon="ArrowRight">
        <el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">{{ item }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="header_right">
      <div class="avatar">
        <el-image class="avatar_img" :src="avatar"/>
      </div>
      <div>
        <el-dropdown>
          <span class="el-dropdown-link">
            {{ nickname }}
            <el-icon class="el-icon--right">
              <arrow-down/>
            </el-icon>
          </span>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>个人中心</el-dropdown-item>
              <el-dropdown-item divided>退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>

<style scoped>
.header_container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  height: 100%;
}

.header_left {

}

.header_right {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.avatar {
  margin-right: 12px;
}

.avatar_img {
  width: 30px;
  height: 30px;
}

.el-dropdown-link {
  display: flex;
  align-items: center;
  border: none;
  outline: none;
}
</style>